

$(function(){
	webUtils.nameSpace("wiseMen.knowledge.auditing");
	
	wiseMen.knowledge.auditing.pass=function(grid){
		var selections =grid.bootstrapTable("getSelections");
		if(selections.length==0){
			webUtils.alert("请至少选择一条记录！！");
			return;
		}
		webUtils.confirm("确定通过审核吗？",function(r){
			if(r){
				var ids=[];
				for(var i=0; i<selections.length; i++){
					ids.push(selections[i]['ID']);
				}
				$.post(ctx + "/KBMS/audit/pass.do",{
					ids:ids.join(',')
				},function(data){
					webUtils.alert(data.msg);
					if(data.success){
						grid.bootstrapTable("refresh");
					}
				},'json');
			}
		});
	}
	
	wiseMen.knowledge.auditing.noPass=function(grid){
		var selections =grid.bootstrapTable("getSelections");
		if(selections.length==0){
			webUtils.alert("请至少选择一条记录！！");
			return;
		}
		webUtils.prompt("请填写原因",function(value){
			var ids=[];
			for(var i=0; i<selections.length; i++){
				ids.push(selections[i]['ID']);
			}
			$.post(ctx + "/KBMS/audit/noPass.do",{
				ids:ids.join(','),
				operatExplain:value
			},function(data){
				webUtils.alert(data.msg);
				if(data.success){
					grid.bootstrapTable("refresh");
				}
			},'json');
		});
	}
	
	wiseMen.knowledge.auditing.perview=function(grid,rowIndex){
		var row = grid.bootstrapTable("getRowByIndex", rowIndex);
		var uuid=webUtils.uuid();
		var d=webUtils.dialog({
			url:ctx+"/KBMS/issue/perviewInfo.do?id="+row.ID+"&winId="+uuid,
			onremove:function(){
				webUtils.topicPublish("dialog.close."+uuid,{uuid:uuid});
			}
		});
	}
});